package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

@AutoRunClass
public class Person {

    private String name = "张三";
    private int age;
    @AutoRunClass
    public Person() {
    }
    @AutoRunClass
    public Person(String name){
        this.name = name;
    }

    public Person(int age) {
        this.age = age;
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    // 普通方法
    public void sayHello(){
        System.out.println(name+ "你好！");
    }
    @AutoRunMethod(value = 1,time="buzhi ")
    public void sayHi(){
        System.out.println(name+ "sayHi！");
    }
    @AutoRunMethod(value = 3,time = "666")
    public void dosome(){System.out.println(name+":做某事");}
    public void sleep(){System.out.println(name+":睡觉");}
    public void watchTV(){System.out.println(name+":看电视");}
    public void study(){System.out.println(name+":在学习");}
    @AutoRunMethod(value = 2,time = "666")
    public void playGame(){System.out.println(name+":玩游戏");}
    public void sing(){System.out.println(name+":在唱歌");}

    public void say(String info){
        System.out.println(name+":"+info);
    }

    public void say(String info, int num){
        for (int i = 0; i < num; i++) {
            System.out.println(name+":"+info);
        }
    }


    private void hehe(){
        System.out.println("私有方法");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
